package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-10-09
 * Time: 10:37
 */


@Repository
public class UserRepository {
    public void say(){
        System.out.println("hello Repository");
    }

    //这里用到的时属性注入
    public UserService userService;
    public void say1(){
        userService.say();
    }


    //构造方法注入
    @Autowired
    public UserRepository(UserService userService){
        this.userService = userService;
        userService.say1();
    }



}
